import { useEffect, useState } from "react";
import * as echarts from "echarts";
import { echartsLine } from "../../http/request";
import { BrowserRouter } from "react-router-dom";


const App = () => {

    useEffect(() => {
        echartsLine().then(res => {
            // console.log(res);
            const myChart = echarts.init(document.getElementById("main"));

            const option = {
                xAxis: {
                    data: res.data.data.x
                },
                yAxis: {},
                series: [
                    {
                        type: 'candlestick',
                        data: res.data.data.val
                    }
                ]
            };

            myChart.setOption(option)
        })

    }, [])

    return (
        <div id="main" style={{ width: "600px", height: "400px" }}></div>
    )
}

export default App

    // < Routes >
    //         <Route path='/' element={<Navigate to="/login"> </Navigate>} ></Route>
    //         <Route path='/login'
    //             element={<Login > </Login>}></Route >
    //         <Route path='/' element={status ? < App > </App> : <Login></Login >} >
    //             <Route path='/home' element={<Home> </Home>}></Route >
    //             <Route path='/banner' >
    //                 <Route path='home' element={<BannerHome> </BannerHome>}> </Route >
    //                 <Route path='active' element={<BannerActive > </BannerActive>}></Route >
    //             </Route> <Route path='/pro' >
    //                 <Route Route path='list' element={< ProList > </ProList>}></Route >
    //                 <Route path='search' element={<ProSearch > </ProSearch>}></Route >
    //             </Route> < Route path='/account' >
    //                 <Route path='userlist' element={< UserList > </UserList>}></ Route>
    //                 <Route path='adminlist' element={< AdminList > </AdminList>}></Route >
    //             </Route> <Route path='/orderfrom' >
    //                 <Route path='orderfromlist' element={< OrderFormList > </OrderFormList>}></Route>
    //             </Route> < Route path='/cart' >
    //                 <Route path='list' element={< CartList > </CartList>}></Route >
    //             </Route> <Route path='/echarts' >
    //                 <Route path="line" element={< Line > </Line>}></Route>
    //                 <Route path="pie" element={< Pie > </Pie>}></Route >
    //             </Route>
    //             <Route path='/setting' element={<Setting> </Setting>}></Route >
    //         </Route>
    //     </Routes>